<#include "../base.ftl"/>
<#macro css>

</#macro>

<#macro js>

</#macro>

<#macro title>
广大物流云平台
</#macro>
<#macro script>

  function initJqGridHideDtlBtn(){
	$("#add_gridSchedulingDtlTable").hide();
  }

  function setBeanName(params,postdata){
	  var shippingId = $("#gridTable").jqGrid(
	            "getGridParam", "selrow");
	  //alert(shippingId);
	  var add_data=new Object();
	     add_data["shippingId"]=shippingId;
	     add_data["status"]='1';
	     add_data["beanName"] = "tsm.TsmSms";
	     
	     return add_data;
  }


$(function(){
    $("#gridTable").jqGrid({
        url:'${request.contextPath}/list!list.action',
        datatype: "json",
        mtype:"POST",
        height: 300,
        width: 550,
        colNames:['船舶编号','船舶代码','船舶名称','类型','船级','船籍港','船员定额','船速','海关编号','船舶呼号','IMO编号','总长','型宽','型深','垂线间长','满载吃水','夏季干舷','船体材料','建造日期','所属船东','状态','创建人','创建日期','最后修改人','最后修改日期'],
        colModel:[
               {name:'shippingId',jsonmap:'SHIPPING_ID',index:'SHIPPING_ID',editable:true,hidden:true},
               {name:'shippingCode',jsonmap:'SHIPPING_CODE',index:'SHIPPING_CODE',editable:true,hidden:true},
               {name:'shippingName',jsonmap:'SHIPPING_NAME',index:'SHIPPING_NAME',editable:true},
               {name:'shippingType',jsonmap:'SHIPPING_TYPE',index:'SHIPPING_TYPE',editable:true,hidden:true},
               {name:'shippingLevel',jsonmap:'SHIPPING_LEVEL',index:'SHIPPING_LEVEL',editable:true,hidden:true,hidden:true},
               {name:'registryPort',jsonmap:'REGISTRY_PORT',index:'REGISTRY_PORT',editable:true},
               {name:'crewNum',jsonmap:'CREW_NUM',index:'CREW_NUM',editable:true},
               {name:'shipSpeed',jsonmap:'SHIP_SPEED',index:'SHIP_SPEED',editable:true},
               {name:'customsNo',jsonmap:'CUSTOMS_NO',index:'CUSTOMS_NO',editable:true,hidden:true},
               {name:'callSign',jsonmap:'CALL_SIGN',index:'CALL_SIGN',editable:true},
               {name:'imoNo',jsonmap:'IMO_NO',index:'IMO_NO',editable:true},
               {name:'shipLength',jsonmap:'SHIP_LENGTH',index:'SHIP_LENGTH',editable:true,hidden:true},
               {name:'shipWidth',jsonmap:'SHIP_WIDTH',index:'SHIP_WIDTH',editable:true,hidden:true},
               {name:'shipDepth',jsonmap:'SHIP_DEPTH',index:'SHIP_DEPTH',editable:true,hidden:true},
               {name:'shipLpp',jsonmap:'SHIP_LPP',index:'SHIP_LPP',editable:true,hidden:true},
               {name:'loadedDraft',jsonmap:'LOADED_DRAFT',index:'LOADED_DRAFT',editable:true,hidden:true},
               {name:'summerFreeboard',jsonmap:'SUMMER_FREEBOARD',index:'SUMMER_FREEBOARD',editable:true,hidden:true},
               {name:'shipMaterial',jsonmap:'SHIP_MATERIAL',index:'SHIP_MATERIAL',editable:true,hidden:true},
               {name:'buildDate',jsonmap:'BUILD_DATE',index:'BUILD_DATE',editable:true,hidden:true,
                 editoptions :  {dataInit: function(element) {
                            $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                        }}   
               
               },
               {name:'ownerName',jsonmap:'OWNER_NAME',index:'OWNER_NAME',editable:true},
               {name:'status',jsonmap:'STATUS',index:'STATUS',editable:true,hidden:true},
               {name:'createdBy',jsonmap:'CREATED_BY',index:'CREATED_BY',editable:true,hidden:true},
               {name:'createdDate',jsonmap:'CREATED_DATE',index:'CREATED_DATE',editable:true,hidden:true,
                 editoptions :  {dataInit: function(element) {
                            $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                        }}   
               },
               {name:'lastUpdBy',jsonmap:'LAST_UPD_BY',index:'LAST_UPD_BY',editable:true,hidden:true},
               {name:'lastUpdDate',jsonmap:'LAST_UPD_DATE',index:'LAST_UPD_DATE',editable:true,hidden:true,
                 editoptions :  {dataInit: function(element) {
                            $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                        }}   
               }
                          ],
        
        sortorder : 'desc',
        viewrecords : true,
        gridview : true,
        rownumbers : true,
        altRows:true,
        rowNum : 20,
        rowList : [10,20,30],
        jsonReader : {
            page : "page.pageNo", //固定名称
            total : "page.totalPages", //固定名称
            records : "page.totalCount", //固定名称
            root : "page.result", //固定名称
            repeatitems : false, //固定
            id : 'SHIPPING_ID'
        },
        prmNames : {
            rows : "page.pageSize",
            page : "page.pageNo",
            sort : "page.orderBy",
            order : "page.order"
        },
        onCellSelect: function(id){
        	//alert(id);
        	//var selectedId=$("gridTable").jqGrid("getGridParam","selrow");
        	    jQuery("#gridSchedulingDtlTable").jqGrid('setGridParam',{
                url : "${request.contextPath}/list!list.action?shippingId="+id,
                page : 1 
            });
        	 $("#add_gridSchedulingDtlTable").show();
        	 jQuery("#gridSchedulingDtlTable").trigger('reloadGrid');
        },
        
        
        loadBeforeSend : function(xhr,settings){
            //设置需要访问的list标签
            settings.data=settings.data+ "&gridKey=/list#TsmShipping";
            return true;
        },
        pager : "#gridPager",
        caption : "船舶列表"
        }).navGrid('#gridPager', {
                edit : false,
                add : false, 
                del : false,
                
                search : false
        }, {  
                //edit
           //beforeSubmit:true,
           //reloadAfterSubmit : true, 
           //closeAfterEdit : true,  //修改完毕后关闭
           //afterComplete : opertaionPrompt, //更新结束后提示信息
           //onclickSubmit: fillCategoryId
        }, {
                //add
           //reloadAfterSubmit : true,
           //closeAfterAdd : true, //新增完毕后关闭
           //afterComplete : opertaionPrompt
           
       })
       
  })

 $(function(){
    $("#gridSchedulingDtlTable").jqGrid({
    //list表格获取地址
        //list表格数据获取地址
        url:'${request.contextPath}/list!list.action',
        //list表格编辑地址
        editurl :'${request.contextPath}/operator.action',
        datatype: "json",
        mtype:"POST",
        height: 300,
        width: 550,
        colNames:['SMS编号','申请人','船舶编号','信息内容','申请日期','说明','状态','创建人','创建日期','最后修改人','最后修改时间','计划发送时间','实际发送时间'],
        colModel:[
            {name:'smsId',jsonmap:'SMS_ID',index:'SMS_ID',editable:false,hidden:true},          
            {name:'applicant',jsonmap:'APPLICANT',index:'APPLICANT',editable:true,editrules:{required:true}},     
            {name:'shippingId',jsonmap:'SHIPPING_ID',editable:true,index:'SHIPPING_ID',hidden:true},
            {name:'content',jsonmap:'CONTENT',editable:true,index:'CONTENT',editrules:{required:true}},
            {name:'applyDate',jsonmap:'APPLY_DATE',editable:true,index:'APPLY_DATE',editrules:{required:true},
                editoptions :  {dataInit: function(element) {
                  $(element).datepicker({changeMonth : true,changeYear : true,changeDate:true,dateFormat : 'yy-mm-dd'});
              }}     
          },   
            {name:'remark',jsonmap:'REMARK',editable:true,index:'REMARK',editrules:{required:true}},
            {name:'status',jsonmap:'STATUS',index:'STATUS',editable:false,hidden:true},
            {name:'createdBy',jsonmap:'CREATED_BY',editable:false,hidden:true},
            {name:'createdDate',jsonmap:'CREATED_DATE',editable:false,hidden:true,
                editoptions :  {dataInit: function(element) {
                    $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                }}       
            },
            {name:'lastUpdBy',jsonmap:'LAST_UPD_BY',editable:false,hidden:true},
            {name:'lastUpdDate',jsonmap:'LAST_UPD_DATE',editable:false,hidden:true,
              editoptions :  {dataInit: function(element) {
                    $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                }}  
            },
            {name:'planSendTime',jsonmap:'PLAN_SEND_TIME',editable:false,index:'PLAN_SEND_TIME',editrules:{required:true},hidden:true,
                editoptions :  {dataInit: function(element) {
                  $(element).datepicker({changeMonth : true,changeYear : true,changeDate:true,dateFormat : 'yy-mm-dd'});
              }}     
          },   
           {name:'realSendTime',jsonmap:'REAL_SEND_TIME',editable:false,index:'REAL_SEND_TIME',hidden:true,
           	editoptions :  {dataInit: function(element) {
               $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
           }}    
           }
        ],
        sortorder:'ASC',
        viewrecords : true,
        gridview : true,
        rownumbers : true,
        rowNum : 20,
        altRows:true,
        rowList : [10,20,30],
        //onSelectRow:cellSelect,
        jsonReader : {
            page : "page.pageNo",
            total : "page.totalPages",
            records : "page.totalCount",
            root : "page.result",
            repeatitems : false,
            id : 'SMS_ID'
        },
        
        
        prmNames : {
            rows : "page.pageSize",
            page : "page.pageNo",
            sort : "page.orderBy",
            order : "page.order"
        },
        loadBeforeSend : function(xhr,settings){
            //设置访问的list标签
            settings.data=settings.data+ "&gridKey=/list/operation#TsmSms";
            return true;
        },
        pager : "#gridSchedulingDtlPager",
        caption : "信息列表"
    }).navGrid("#gridSchedulingDtlPager",{
            edit:false,
            //editfunc:editSelect,
            add:true, 
            //addfunc:addVoyage,
            del:false, 
            //delfunc:selectDel,
            search: false
    },{ 
        //edit
        //beforeSubmit:cellSelect,
        reloadAfterSubmit:true,
        closeAfterEdit:true,//新增完毕后关闭
        afterComplete:opertaionPrompt,//更新结束后提示信息
        //onclickSubmit: setBeanName  //触发的事件
    },{
    //add
        reloadAfterSubmit : true,
        closeAfterAdd : true, //新增完毕后关闭
        afterComplete : opertaionPrompt,
        onclickSubmit: setBeanName
    },{
      //del
        reloadAfterSubmit : true, 
        closeAfterEdit : true,  //修改完毕后关闭
        afterComplete : opertaionPrompt, //更新结束后提示信息
        //onclickSubmit: fillCategoryId,    
        
    });
    initJqGridHideDtlBtn();
    
    
   
});
 

</#macro>

<#macro main>
  <div id="detaildiv" style="margin:30px 10px 20px -20px;float:left;width:200px">
           <table id="gridTable"></table>
           <div id="gridPager"></div>
  </div>
  <div id="schedulingDiv" style="background-color:Navy;margin:30px -10px 100px 350px;float:left;width:200px;">
           <table id="gridSchedulingDtlTable"></table>
           <div id="gridSchedulingDtlPager"></div>
</div>
 
</#macro>

